

import 'package:moonplay/widgets/common_text_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

/**
 * 自定义上拉加载底部指示器
 */

Widget buildCustomFooter(context, mode){
  String _tips;
  if (mode == LoadStatus.idle) {
    _tips = "上拉加载";
  } else if (mode == LoadStatus.loading) {
    _tips = "加载中";
  } else if (mode == LoadStatus.failed) {
    _tips = "加载失败,请重试";
  } else if (mode == LoadStatus.canLoading) {
    _tips = "释放以加载更多";
  } else {
    _tips = "没有更多啦~";
  }
  return Container(
    height: 40,
    alignment: Alignment.center,
    child: Row(
      crossAxisAlignment: CrossAxisAlignment.center,
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        mode == LoadStatus.loading ?
        CupertinoActivityIndicator(
          radius: 8,
        ) : Container(),
        SizedBox(width: 4,),
        Container(
          child: Cptext(text: _tips,style: TextStyle(color: Theme.of(context).cardColor, fontSize: 14),),
        )
      ],
    )
  );
}